<?php
namespace app\hospital\controller;
use app\BaseController;
use app\hospital\model\subjecttype;
use think\facade\Db;
use think\facade\View;
use think\facade\Request;
class subjectc extends BaseController{
    function list(){
        $data=Db::table('subjecttype')->paginate(5);
        View::assign('data',$data);
        return View::fetch();
    }
    function update(){
        $data=Request::post();
        $d=new subjecttype();
        $res=$d->update($data);
//        dump($data);
//      $res=Db::table('doctor')->update($data);
//        dump($res);
        if(!empty($res)){
            return 1;
        }else{
            return 0;
        }
//        return ($res);
    }
    function edit(){
        $id=Request::get('id');
        $d=new subjecttype();
        $data=$d->find($id);
//        $data=Db::table('doctor')->find($id);
        return json($data);
    }
    public function del(){
        $id=Request::param('id');
//        $d=new subjecttype();
        $res=Db::table('subjecttype')->where('id',$id)->delete();
//        $res=$d->del();
        if(!empty($res)){
            return 1;
        }else{
            return 0;
        }
//        dump($res);
//        return $res;
    }
}